package com.yuven.baselib.component.eventbus;

import org.greenrobot.eventbus.EventBus;

/**
 * @author :        Yuven
 * @date :          2020/7/22 1:38 PM
 * @desc :
 */
public class EventBusUtil {

    public static void register(Object subscriber) {
        if (!EventBus.getDefault().isRegistered(subscriber)) {
            EventBus.getDefault().register(subscriber);
        }
    }

    public static void unregister(Object subscriber) {
        if (EventBus.getDefault().isRegistered(subscriber)) {
            EventBus.getDefault().unregister(subscriber);
        }
    }

    public static void post(Event event) {
        EventBus.getDefault().post(event);
    }

    public static void postSticky(Event event) {
        EventBus.getDefault().postSticky(event);
    }
}
